<!-- Custom Style -->
<?php
include "../proses/konek.php";
session_start();
if(!isset($_SESSION['username']))
   {   
  ?><script language="javascript">alert('anda blm login');
document.location='../'</script><?php 
}
else
{
$username = $_SESSION['username'];
$status = $_SESSION['status'];
}
?>
<html>
<head style='heigh:50px;'>
<title>E-Learning of TetraSMA</title>
<link rel="stylesheet" href="../css/sidebar.css">
<link rel="stylesheet" type="text/css" href="../css/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="../css/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="../css/bootstrap/css/profile.css">
<link rel="stylesheet" type="text/css" href="../css/timeline.css">
	<!-- Bootstrap Core Theme -->
<link rel="stylesheet" href="../css/bootstrap/css/bootstrap-theme.min.css">
<?php	
	require_once('../render.php');
	$render=new render;
	$render->icon();
	$render->navigasi();
	$render->profile($status, $username);
	
?>
</head>
<body>

<div id="wrapper">
	<div id="sidebar-wrapper">
		<?php
		include ('menuslide.php');
		$menu=new menu;
		$menu->init($username, $status);
		?>
	</div>
	
	<div id="page-content-wrapper">
		<div class="container-fluid">
			<div class="row">
				<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="subcontent">
				<?php
				if(isset($_GET['judul']))
				{
					$judul=mysql_real_escape_string($_GET['judul']);
					
					$sql=mysql_query("SELECT * FROM posting WHERE judul LIKE '%{$judul}%'  ");
					while ($list = mysql_fetch_assoc($sql)) {
								// echo data
						?>
				          <!--/stories-->
				  <div class="row">    
		            <br>
		            <div class="col-md-2 col-sm-3 text-center">
		              <a class="story-img" href="viewprofile.php?e=<?php echo $list['author']?>"><img src="<?php $img=mysql_query("SELECT img FROM guru where email= '$list[author]' ");
							$rsimg= mysql_fetch_array($img);

			              echo $rsimg['img'] ?>" style="width:100px;height:100px" class="img-circle"></a>
		            </div>
		            <div class="col-md-10 col-sm-9">
		              <h3><?php
									print ($list['judul']);
								?></h3>
		              <div class="row">
		                <div class="col-xs-9">
		                  <p><?php
									print ($list['isi']);
								?></p>
		                  <p class="lead">
		                  	
		                  	<a href="view.php? id=<?php echo $list['idpost']?>">
		                  		<button class="btn btn-default">Read More</button>
		                  	</a>
		                  </p>
		                  <p class="pull-right"><span class="label label-default"><?php echo $list['kategori']?></span> <span class="label label-default"><?php echo $list['kelas']?></span> </p>
		                  <!-- <ul class="list-inline"><li><a href="#">2 Days Ago</a></li><li><a href="#"><i class="glyphicon glyphicon-comment"></i> 4 Comments</a></li><li><a href="#"><i class="glyphicon glyphicon-share"></i> 34 Shares</a></li></ul> -->
		                  </div>
		                <div class="col-xs-3"></div>
		              </div>
		              <br><br>
		            </div>
		          </div>


                		<?php
							}
							if(mysql_num_rows($sql)==0)
							{
								echo '
					<div class="row">    
		            <br>
		            <div class="col-md-10 col-sm-9">
		              <h1><strong>NOT FOUND</strong></h1>
		             </div>
		             </div>';
							}

				}
				else if($_POST['kelas']!='--Pilih Kelas--'&&$_POST['mapel']!='--Pilih MApel--'&&$_POST['guru']!='--Pilih Guru--')
				{
					$kelas=$_POST['kelas'];
					$mapel=$_POST['mapel'];
					$guru=$_POST['guru'];
					$sql=mysql_query("SELECT * FROM posting WHERE kategori = '$mapel'and kelas = '$kelas' and author = '$guru' ");
					while ($list = mysql_fetch_assoc($sql)) {
								// echo data
						?>
				          <!--/stories-->
				  <div class="row">    
		            <br>
		            <div class="col-md-2 col-sm-3 text-center">
		              <a class="story-img" href="viewprofile.php?e=<?php echo $list['author']?>"><img src="<?php 
				              	$img=mysql_query("SELECT img FROM guru where email= '$list[author]' ");
								$rsimg= mysql_fetch_array($img);

				              echo $rsimg['img'] ?>" style="width:100px;height:100px" class="img-circle"></a>
		            </div>
		            <div class="col-md-10 col-sm-9">
		              <h3><?php
									print ($list['judul']);
								?></h3>
		              <div class="row">
		                <div class="col-xs-9">
		                  <p><?php
									print ($list['isi']);
								?></p>
		                  <p class="lead">
		                  	
		                  	<a href="view.php? id=<?php echo $list['idpost']?>">
		                  		<button class="btn btn-default">Read More</button>
		                  	</a>
		                  </p>
		                  <p class="pull-right"><span class="label label-default"><?php echo $list['kategori']?></span> <span class="label label-default"><?php echo $list['kelas']?></span> </p>
		                  <!-- <ul class="list-inline"><li><a href="#">2 Days Ago</a></li><li><a href="#"><i class="glyphicon glyphicon-comment"></i> 4 Comments</a></li><li><a href="#"><i class="glyphicon glyphicon-share"></i> 34 Shares</a></li></ul> -->
		                  </div>
		                <div class="col-xs-3"></div>
		              </div>
		              <br><br>
		            </div>
		          </div>
                		<?php
							} // end while
	
				}
				else
				{
					echo '
					<div class="row">    
		            <br>
		            <div class="col-md-10 col-sm-9">
		              <h1><strong>NOT FOUND</strong></h1>
		             </div>
		             </div>';
				}

				?>	
				</div>

			</div>
		</div>
	</div>
</div>

<!-- JQuery Core -->


<script src="../js/search.js"></script>
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<!-- Custom Sidebar Javascript -->
<script type="text/javascript" src="../js/sidebar.js"></script>
<!-- Custom Javascript Load Page -->
<script type="text/javascript" src="../js/metisMenu.min.js"></script>
<script src="../js/sb-admin-2.js"></script>
<script type="text/javascript" src="../css/bootstrap/js/bootstrap.js"></script>
<div>
	<?php
	$render->footer();
	?>
</div>
</body>
</html>

	
